[NFCI] Remove getLifetimeStartIntrinsic function from SPIRVReader#3373
Merged
MrSidims merged 2 commits intoKhronosGroup:mainfrom Oct 2, 2025
Merged
[NFCI] Remove getLifetimeStartIntrinsic function from SPIRVReader#3373MrSidims merged 2 commits intoKhronosGroup:mainfrom
MrSidims merged 2 commits intoKhronosGroup:mainfrom
Conversation
added 2 commits
October 1, 2025 06:51
With new lifetime.start/end rules, which are: "The argument is either a pointer to an alloca instruction or a poison value." it became obsolete on main branch. Moreover, it seem to be redundant overall, as IR like this was legal: %0 = alloca ... %1 = bitcast %0 call void @llvm.lifetime.start(..., %1) %2 = bitcast %0 call void @llvm.lifetime.end(..., %2) Further implecations, and why this patch will be backported on older branches. Right now there is a possibility to have a round-trip translation failed, when it goes from main to pre-opaque pointers branches as a bitcast from alloca to i8* will be inserted before lifetime.start call. Later, due to the current logic, this bitcast will be reused for lifetime.end call. But, lifetime.end won't always post-dominate lifetime.start (in this case the object will be considered dead at function return block), hence the bitcast won't dominate the lifetime.stop call, invalidating the generated module. Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Contributor
Author
|
@maarquitos14 @YuriPlyakhin @YixingZhang007 please help with the review. |
YuriPlyakhin
approved these changes
Oct 1, 2025
Contributor
YuriPlyakhin
left a comment
There was a problem hiding this comment.
This change makes sense to me and also backporting it as well
maarquitos14
approved these changes
Oct 2, 2025
svenvh
approved these changes
Oct 2, 2025
dm-vodopyanov
pushed a commit
to intel/llvm
that referenced
this pull request
Oct 9, 2025
#20287) SPIRVReader has contained a bug for a long time, fixed in KhronosGroup/SPIRV-LLVM-Translator#3373 While the proper fix will be backported to earlier branches - it still will take a lot of time for adoption by LTS driver. Hence we have to add a W/A restoring old behaviour of lifetime intrinsics translation, inserting artificial bitcast to i8*. PR also includes update of a test from KhronosGroup/SPIRV-LLVM-Translator#3376 --------- Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com>
Contributor
Author
|
/backport to llvm_release_210 |
|
Invalid backport command. Expected |
Contributor
Author
|
/backport llvm_release_210 |
|
Attempting to create backport to |
|
Backport to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With new lifetime.start/end rules, which are:
"The argument is either a pointer to an alloca instruction or a poison
value."
it became obsolete on main branch. Note, no test is possible to add
on the main branch.
Moreover, it seem to be redundant overall, as IR like this was legal:
%0 = alloca ...
%1 = bitcast %0
call void @llvm.lifetime.start(..., %1)
%2 = bitcast %0
call void @llvm.lifetime.end(..., %2)
Further implecations, and why this patch will be backported on older
branches. Right now there is a possibility to have a round-trip
translation failed, when it goes from main to pre-opaque pointers
branches as a bitcast from alloca to i8* will be inserted before
lifetime.start call. Later, due to the current logic, this bitcast will
be reused for lifetime.end call. But, lifetime.end won't always post-dominate
lifetime.start (in this case the object will be considered dead at
function return block), hence the bitcast won't dominate the
lifetime.stop call, invalidating the generated module.
Signed-off-by: Sidorov, Dmitry dmitry.sidorov@intel.com